// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:palmf_hid/common/values/values.dart';

Widget inputScreeningWidget({
  required FocusNode searchFocusNode,
  required TextEditingController textEditingController,
  required Function onChange,
  required Function onSubmitted,
  required String? hintText,
  required TextInputType? keyboardType,
  required Widget? close,
}) {
  return Container(
    width: 1.sw,
    height: 30,
    padding: const EdgeInsets.symmetric(horizontal: 5),
    margin: const EdgeInsets.all(0),
    alignment: Alignment.centerLeft,
    decoration: BoxDecoration(
        border: Border.all(
          color: MyColor.c_FFEAEAEA,
          width: 1,
        ),
        borderRadius: BorderRadius.circular(4),
        color: MyColor.c_FFFFFFFF),
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        Expanded(
            child: TextField(
          magnifierConfiguration: const TextMagnifierConfiguration(
              shouldDisplayHandlesInMagnifier: false),
          focusNode: searchFocusNode,
          controller: textEditingController,
          autofocus: false,
          textInputAction: TextInputAction.search,
          onChanged: (e) {
            onChange(e);
          },
          style: TextStyle(fontSize: 12, color: MyColor.c_66000000),
          decoration: InputDecoration(
            isDense: true,
            contentPadding:
                const EdgeInsets.symmetric(vertical: 0, horizontal: 10),
            fillColor: Colors.white,
            filled: true,
            focusedBorder: const OutlineInputBorder(
              borderSide: BorderSide(color: Colors.transparent, width: 1),
            ),
            enabledBorder: const OutlineInputBorder(
              borderSide: BorderSide(color: Colors.transparent, width: 1),
            ),
            hintText: hintText,
            hintMaxLines: 1,
            hintStyle: TextStyle(color: MyColor.c_66000000, fontSize: 12),
          ),
          scrollPadding: EdgeInsets.only(bottom: 0.4.sh),
          keyboardType: keyboardType ?? TextInputType.text,
          onSubmitted: (e) {
            onSubmitted();
          },
        )),
        close ?? SizedBox()
      ],
    ),
  );
}
